<template>
	<view>
		<u-loading-page :loading="loadding" loading-mode="semicircle" loading-text="Hello Pro"></u-loading-page>
		<view class="banner_box" v-if="!loadding">
			<view class="" style="display: flex; justify-content: space-between;">
				<view class=""></view>
				<message :color="'fff'"></message>
			</view>
			<view class="banner_tit">
				<view class="banner_tit_flex" @click="data_info(0)" style="text-align: center;">
					<text>昨日收益</text>
					<h3>{{getIndexData.day_profit}}</h3>
				</view>
				<view class="banner_tit_flex" @click="data_info(1)" style="text-align: center;">
					<text>本月收益</text>
					<h3>{{getIndexData.month_profit}}</h3>
				</view>
			</view>
			<view class="check">
				<image :showLoading="true" src="/static/home_bt.png" @click="joins()"></image>
			</view>
		</view>
		<view class="banner_cont">
			<view class="banner_list" @click="data_info_">
				<text class="H">{{getIndexData.active_month}}</text>
				<text>本月激活</text>
			</view>
			<view class="banner_list" @click="data_info_">
				<text class="H">{{getIndexData.active_today}}</text>
				<text>昨日激活</text>
			</view>
			<view class="banner_list" @click="data_info_">
				<text class="H">{{getIndexData.active_total}}</text>
				<text>累计激活</text>
			</view>
		</view>
		<view class="manage_box" v-if="!loadding">
			<view class="manage_box_outer">
				<view class="manage_list" v-for="(list,index) in menu" :key="index" @click="manage(list.path)">
					<image class="img" :src="src + list.logo_image" mode="aspectFit"></image>
					<text>{{list.name}}</text>
				</view>
			</view>
		</view>
		<u--image :showLoading="true" src="/static/jn.jpg" height="185rpx" width="750rpx"
			@click="Select_product()"></u--image>

	</view>
</template>

<script>
	import message from '@/component/message.vue'
	var util = require('@/util/request5.js');
	export default {
		data() {
			return {
				loadding: true,
				getIndexData: {},
				yesterday: null,
				menu: [],
				src: ''
			}
		},
		components: {
			message
		},
		onLoad() {
			this.src = util.realm_name.substr(0, util.realm_name.length - 5)
			this._getIndexData()
			this._menu()
			this.getCurrentTime()
		},
		methods: {
			//获取时间
			getCurrentTime() {
				let Time = new Date();
				Time.setTime(Time.getTime() - 24 * 60 * 60 * 1000);
				this.yesterday = Time.getFullYear() + "-" + (Time.getMonth() + 1) + "-" + Time.getDate();
			},
			// 菜单展示
			async _menu() {
				const userinfo = uni.getStorageSync('userinfo');
				const {
					data: res
				} = await this.$myHttp5({
					url: 'menu/getMenu',
					// data: {},
					header: {
						'token': userinfo.token
					},
				});
				if (res.code == 1) {
					this.menu = res.data[0].childlist
				}
			},
			// 页面数据展示
			async _getIndexData() {
				const userinfo = uni.getStorageSync('userinfo');
				const {
					data: res
				} = await this.$myHttp5({
					url: 'v1/getIndexData',
					header: {
						'token': userinfo.token
					},
				});
				this.loadding = false
				this.getIndexData = res.data
			},
			//终端设置
			manage(path) {
				uni.navigateTo({
					url: path
				})
			},
			// 数据详情
			data_info(id) {
				uni.navigateTo({
					url: '/pages/version5/mine/account/account?id=' + id
				})
			},
			data_info_() {
				uni.navigateTo({
					url: '/pages/version5/data/active/data_info?type=1'
				})
			},
			joins() {
				uni.navigateTo({
					url: '/pages/version5/mine/aboutus/aboutus?id=1&name=业务推广'
				})
			},
			Select_product() {
				uni.navigateTo({
					url: '/pages/version5/public/Select_product/Select_product'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.banner_box {
		display: flex;
		flex-direction: column;
		background: url('/static/top_bg.png') no-repeat center;
		background-size: 100% 100%;
		height: 560rpx;
		border-bottom-left-radius: 20rpx;
		border-bottom-right-radius: 20rpx;
		padding: 0 26rpx;
		position: relative;

		.banner_tit {
			// padding: 0 70rpx;
			box-sizing: border-box;
			display: flex;

			.banner_tit_flex {
				flex: 1;

				flex-direction: column;
				align-items: center;

				h3 {
					color: #fff;
					font-size: 56rpx;
					margin-bottom: 10rpx;
				}

				text {
					font-size: 24rpx;
					color: #bfe2ff;
				}
			}

		}
	}

	.banner_cont {
		padding: 50rpx 0rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		width: 90%;
		background: url(@/static/sj_bg.jpg)no-repeat center;
		margin: 70rpx auto 0 auto;
		border-radius: 5px;
		box-shadow: 0px 0px 20px -12px #342f2f;

		.banner_list {
			display: flex;
			flex-direction: column;
			flex: 1;

			.H {
				font-size: 34rpx !important;
				color: #8d5c25;
				padding-bottom: 20rpx;

			}

			text {
				font-size: 28rpx;
				color: #9f7935;
				text-align: center;

			}
		}
	}

	.manage_box {
		display: flex;
		flex-direction: column;
		padding: 70rpx 30rpx 20rpx 30rpx;

		.manage_box_outer {
			display: flex;
			flex-wrap: wrap;


			.manage_list {
				display: flex;
				flex-direction: column;
				align-items: center;
				min-width: 25%;
				margin-bottom: 20rpx;

				.img {
					width: 80rpx;
					height: 80rpx;
				}
			}
		}

		text {
			font-size: 28rpx;

			line-height: 50rpx;
			;
		}

	}

	.check {
		position: absolute;
		left: 50%;
		transform: translate(-50%, -50%);
		bottom: -7%;
		font-size: 0;
		width: 198rpx;
		height: 54rpx;

		// background: url('@/static/home_bt.png') no-repeat center;

		image {
			display: flex;
			width: 95px;
			height: 100%;
		}
	}
</style>